﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kooboo.HtmlFunc;
using Kooboo.HtmlFunc.Providers;

namespace Kooboo.CMS.SiteConverter.Parser.WebForm
{
    public class DetailParser : ParserBase, IParser<IDetail>
    {
        #region IParser<IDetail> Members

        public void Parse(IDetail obj)
        {
            //declare
            var declare = "<%@ Control Language=\"C#\" Inherits=\"System.Web.Mvc.ViewUserControl<dynamic>\" %>" + Environment.NewLine;
            obj.StartNode.ParentNode.InsertAfter(NodeExtension.CreateNode(declare), obj.StartNode);

            var fieldFormat = @"<%:ViewHelper.EditField(ViewBag.{0}, ""{1}"")%>";//var fieldFormat = @"<%=ViewBag.{0}.{1}%>";
            //var linkFormat = @"<%:Url.FrontUrl().PageUrl(""{0}"", new {{ UserKey = item.UserKey }})%>";
            Razor.DetailParser.FillResult(this.Context, obj, this.EngineName, fieldFormat/*, linkFormat*/);
        }

        #endregion
    }
}
